﻿#include "signalfactory.h"
std::shared_ptr<SignalFactory> SignalFactory::instance_ = nullptr;
std::mutex SignalFactory::mutex_;

SignalFactory::SignalFactory(QObject *parent) : QObject(parent)
{

}

std::shared_ptr<SignalFactory> &SignalFactory::SignalInstance()
{
    if(nullptr == instance_)
    {
        std::lock_guard<std::mutex> lg_mutex(mutex_);  // 上锁
        if(nullptr == instance_)
        {
            instance_ = std::shared_ptr<SignalFactory>(new SignalFactory);
        }
    }
    return instance_;
}
